package com.yf1706.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yf1706.bean.CheckAffariCategory;
import com.yf1706.bean.CheckHolidayKind;
import com.yf1706.dao.jpa.ICheckAffairCategoryJDAO;
import com.yf1706.dao.mybatis.ICheckAffairCategoryMDAO;

@Service
@Transactional(rollbackFor=Exception.class)
public class CheckAffariCategoryService {
	@Autowired 
	private ICheckAffairCategoryMDAO cacMDao;
	@Autowired
	private ICheckAffairCategoryJDAO cacJDao;
	
	public List<CheckAffariCategory> getCheckAffairCategoryList(){
		return cacMDao.queryCheckAffariCategory();
    }
   //存储新增的事务类别数据
	public void addAffariCategory(CheckAffariCategory cac) {
		cac.setMakeTime(new Date());
		cac.setState("是");
		cacJDao.save(cac);
		}
	 //删除指定的事务类别数据
	public void deleteAffariCategory(int categoryId) {
		cacJDao.deleteById(categoryId);
		}
	//模糊查询事务类型信息
	public List<CheckAffariCategory> getSerchAffairCategoryList(String affairName){
		return cacMDao.CheckAffariCategory(affairName);
	}
	 //修改之后的事务类别数据
	public void updateAffairCategory(CheckAffariCategory cac) {
		cac.setUpdateTime(new Date());
		cac.setState("是");
		cacJDao.save(cac);
	}
}
